// authDirective.js
import { useStore } from "@/store/index"; //引入store
// 权限指令
export const authDirective = {
  mounted(el, binding) {
    const store = useStore();
    const requiredRole = binding.value;
    let arrs = store.accountObjItem.authorities || [];
    // 判断返回的数据是否存在这个权限 不存在则删除这个元素
    if (!arrs.includes(requiredRole)) {
      el.parentNode.removeChild(el); // 删除元素
    }
  },
};
